package pro.ticktock.base.tree.api;

import pro.ticktock.base.tree.impl.HashEntryTreeNodeImpl;
import pro.ticktock.base.tree.impl.ListEntryTreeNodeImpl;
import pro.ticktock.base.tree.impl.NodeEntry;
import pro.ticktock.base.tree.impl.TreeNodeImpl;

/**
 * @author lambert
 * @created 18-9-30
 */
public class TreeNodes {

  public static <NV> TreeNode<NV> buildNode() {
    return new TreeNodeImpl<>();
  }

  public static <NV> TreeNode<NV> buildNode(NV value) {
    return new TreeNodeImpl<>(value);
  }

  public static <K, V> EntryTreeNode<K, V> buildListEntryNode() {
    return new ListEntryTreeNodeImpl<>();
  }

  public static <K, V> EntryTreeNode<K, V> buildListEntryNode(K key, V value) {
    return new ListEntryTreeNodeImpl<>(key, value);
  }

  public static <K, V> HashEntryTreeNode<K, V> buildHashEntryNode() {
    return new HashEntryTreeNodeImpl<>();
  }

  public static <K, V> HashEntryTreeNode<K, V> buildHashEntryNode(K key, V value) {
    return new HashEntryTreeNodeImpl<>(key, value);
  }

  public static <K, V> Entry<K, V> makeEntry(K key, V value) {
    return new NodeEntry<>(key, value);
  }

}
